package web.fabrimind.sm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.sm.mapper.ProductionShiftMapper;
import web.fabrimind.sm.domain.ProductionShift;
import web.fabrimind.sm.service.IProductionShiftService;

/**
 * 生产班次Service业务层处理
 * 
 * @author zhihui
 * @date 2025-03-30
 */
@Service
public class ProductionShiftServiceImpl implements IProductionShiftService 
{
    @Autowired
    private ProductionShiftMapper productionShiftMapper;

    /**
     * 查询生产班次
     * 
     * @param shiftId 生产班次主键
     * @return 生产班次
     */
    @Override
    public ProductionShift selectProductionShiftByShiftId(Long shiftId)
    {
        return productionShiftMapper.selectProductionShiftByShiftId(shiftId);
    }

    /**
     * 查询生产班次列表
     * 
     * @param productionShift 生产班次
     * @return 生产班次
     */
    @Override
    public List<ProductionShift> selectProductionShiftList(ProductionShift productionShift)
    {
        return productionShiftMapper.selectProductionShiftList(productionShift);
    }

    /**
     * 新增生产班次
     * 
     * @param productionShift 生产班次
     * @return 结果
     */
    @Override
    public int insertProductionShift(ProductionShift productionShift)
    {
        productionShift.setCreateTime(DateUtils.getNowDate());
        return productionShiftMapper.insertProductionShift(productionShift);
    }

    /**
     * 修改生产班次
     * 
     * @param productionShift 生产班次
     * @return 结果
     */
    @Override
    public int updateProductionShift(ProductionShift productionShift)
    {
        productionShift.setUpdateTime(DateUtils.getNowDate());
        return productionShiftMapper.updateProductionShift(productionShift);
    }

    /**
     * 批量删除生产班次
     * 
     * @param shiftIds 需要删除的生产班次主键
     * @return 结果
     */
    @Override
    public int deleteProductionShiftByShiftIds(Long[] shiftIds)
    {
        return productionShiftMapper.deleteProductionShiftByShiftIds(shiftIds);
    }

    /**
     * 删除生产班次信息
     * 
     * @param shiftId 生产班次主键
     * @return 结果
     */
    @Override
    public int deleteProductionShiftByShiftId(Long shiftId)
    {
        return productionShiftMapper.deleteProductionShiftByShiftId(shiftId);
    }
}
